Skip to content

Устранение уязвимостей безопасности (Security Patch)#2

Open
Antony-hash512 wants to merge 12 commits into
HelpFreedom:mainfrom
Antony-hash512:antony512-security-fixes
Open

Устранение уязвимостей безопасности (Security Patch)#2
Antony-hash512 wants to merge 12 commits into
HelpFreedom:mainfrom
Antony-hash512:antony512-security-fixes

Conversation

@Antony-hash512

@Antony-hash512 Antony-hash512 commented Jun 16, 2026

Copy link
Copy Markdown

Этот пулреквест устраняет 9 уязвимостей (из них 8 высокого уровня критичности — High), обнаруженных через npm audit. Для устранения рисков потребовался мажорный апгрейд ключевых библиотек и сопутствующая адаптация кодовой базы.
В моей версии результат npm audit теперь полностью чистый:

fireice@katana ~/git/kadr (antony512-security-fixes) 
🐟 npm audit
found 0 vulnerabilities
fireice@katana ~/git/kadr (antony512-security-fixes) 
🐟 
Результат npm audit до предлагамых мной изменений (кликнете сюда, чтобы открыть/свернуть)
fireice@katana ~/git/kadr (main) 
🐟 npm audit
# npm audit report

electron  <=39.8.4
Severity: high
Electron has ASAR Integrity Bypass via resource modification - https://github.com/advisories/GHSA-vmqv-hx8q-j7mg
Electron: AppleScript injection in app.moveToApplicationsFolder on macOS - https://github.com/advisories/GHSA-5rqw-r77c-jp79
Electron: Service worker can spoof executeJavaScript IPC replies - https://github.com/advisories/GHSA-xj5x-m3f3-5x3h
Electron: Incorrect origin passed to permission request handler for iframe requests - https://github.com/advisories/GHSA-r5p7-gp4j-qhrx
Electron: Out-of-bounds read in second-instance IPC on macOS and Linux - https://github.com/advisories/GHSA-3c8v-cfp5-9885
Electron: nodeIntegrationInWorker not correctly scoped in shared renderer processes - https://github.com/advisories/GHSA-xwr5-m59h-vwqr
Electron: Use-after-free in offscreen child window paint callback - https://github.com/advisories/GHSA-532v-xpq5-8h95
Electron: Registry key path injection in app.setAsDefaultProtocolClient on Windows - https://github.com/advisories/GHSA-mwmh-mq4g-g6gr
Electron: Use-after-free in download save dialog callback - https://github.com/advisories/GHSA-9w97-2464-8783
Electron: Use-after-free in WebContents fullscreen, pointer-lock, and keyboard-lock permission callbacks - https://github.com/advisories/GHSA-8337-3p73-46f4
Electron: Use-after-free in PowerMonitor on Windows and macOS - https://github.com/advisories/GHSA-jjp3-mq3x-295m
Electron: Unquoted executable path in app.setLoginItemSettings on Windows - https://github.com/advisories/GHSA-jfqx-fxh3-c62j
Electron: HTTP Response Header Injection in custom protocol handlers and webRequest - https://github.com/advisories/GHSA-4p4r-m79c-wq3v
Electron: USB device selection not validated against filtered device list - https://github.com/advisories/GHSA-9899-m83m-qhpj
Electron: Crash in clipboard.readImage() on malformed clipboard image data - https://github.com/advisories/GHSA-f37v-82c4-4x64
Electron: Named window.open targets not scoped to the opener's browsing context - https://github.com/advisories/GHSA-f3pv-wv63-48x8
Electron: Renderer command-line switch injection via undocumented commandLineSwitches webPreference - https://github.com/advisories/GHSA-9wfr-w7mm-pc7f
fix available via `npm audit fix --force`
Will install electron@42.4.0, which is a breaking change
node_modules/electron

esbuild  <=0.28.0
Severity: high
esbuild enables any website to send any requests to the development server and read the response - https://github.com/advisories/GHSA-67mh-4wv8-2f99
esbuild: Missing binary integrity verification in Deno module enables remote code execution via NPM_CONFIG_REGISTRY - https://github.com/advisories/GHSA-gv7w-rqvm-qjhr
fix available via `npm audit fix --force`
Will install vite@8.0.16, which is a breaking change
node_modules/esbuild
  electron-vite  <=3.0.0
  Depends on vulnerable versions of esbuild
  Depends on vulnerable versions of vite
  node_modules/electron-vite
  vite  <=6.4.2
  Depends on vulnerable versions of esbuild
  node_modules/vite

tar  <=7.5.15
Severity: high
node-tar Vulnerable to Arbitrary File Creation/Overwrite via Hardlink Path Traversal - https://github.com/advisories/GHSA-34x7-hfp2-rc4v
node-tar is Vulnerable to Arbitrary File Overwrite and Symlink Poisoning via Insufficient Path Sanitization - https://github.com/advisories/GHSA-8qq5-rm4j-mr97
Arbitrary File Read/Write via Hardlink Target Escape Through Symlink Chain in node-tar Extraction - https://github.com/advisories/GHSA-83g3-92jg-28cx
tar has Hardlink Path Traversal via Drive-Relative Linkpath - https://github.com/advisories/GHSA-qffp-2rhf-9h96
node-tar Symlink Path Traversal via Drive-Relative Linkpath - https://github.com/advisories/GHSA-9ppj-qmqm-q256
Race Condition in node-tar Path Reservations via Unicode Ligature Collisions on macOS APFS - https://github.com/advisories/GHSA-r6q2-hw4h-h46w
node-tar applies PAX size override to intermediary GNU long-name/long-link headers, causing tar parser interpretation differential (file smuggling) - https://github.com/advisories/GHSA-vmf3-w455-68vh
fix available via `npm audit fix --force`
Will install @electron/rebuild@4.0.4, which is a breaking change
node_modules/tar
  @electron/node-gyp  *
  Depends on vulnerable versions of make-fetch-happen
  Depends on vulnerable versions of tar
  node_modules/@electron/node-gyp
    @electron/rebuild  3.2.10 - 4.0.2
    Depends on vulnerable versions of @electron/node-gyp
    Depends on vulnerable versions of tar
    node_modules/@electron/rebuild
  cacache  14.0.0 - 18.0.4
  Depends on vulnerable versions of tar
  node_modules/cacache
    make-fetch-happen  7.1.1 - 14.0.0
    Depends on vulnerable versions of cacache
    node_modules/make-fetch-happen


9 vulnerabilities (1 moderate, 8 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Так же у меня всё собирается и запускается без ошибок т.к. код адаптирован под новые версии библиотек, тесты также у меня выполняются успешно.

🛡️ Что исправлено (Безопасность):

  • Electron (^31.7.7^42.4.0): Закрыты критические уязвимости обхода целостности ASAR-архивов, инъекций AppleScript, Service Worker Spoofing и утечек памяти (Out-of-bounds read / Use-after-free).
  • Vite (^5.4.8^7.3.5) & esbuild: Устранена уязвимость обхода Cross-origin на локальном dev-сервере и риск удаленного выполнения кода (RCE).
  • @electron/rebuild (^3.7.2^4.0.4): Обновлен пакет tar для защиты от перезаписи произвольных файлов (Path Traversal / Symlink Poisoning).

🔧 Адаптация кода под новые версии библиотек:

Мажорные обновления потребовали следующих правок в коде:

  • React 19: Изменены типы рефов в компонентах FragmentGizmo и FragmentOverlays под строгие требования React 19. Добавлен .npmrc с legacy-peer-deps=true для бесконфликтной установки зависимостей.
  • Electron 42: Файл electron/main.ts адаптирован под новую версию.
  • TypeScript & Сборка: Исправлены относительные пути алиаса @shared/* в tsconfig.json. В компоненте MediaBin.tsx добавлен безопасный фоллбек для списка текстов.

🤖 Как проверить этот PR с помощью Claude Code

Если вы используете Claude Code, вы можете поручить ему автоматически скачать ветку, провести код-ревью и протестировать изменения.

  1. Установите пакет gh через пакетный менеджер вашей ос для работы с гитхабом
  2. Запустите Claude Code в корневой директории проекта, прикрутите к нему MCP-сервер context7 (как это сделать можно спросить у самого же Клода)
  3. Попросите Claude скачать и проверить этот пулреквест, используя например вот такой промт:

    "Проверь и протестируй пулреквест Устранение уязвимостей безопасности (Security Patch) #2 от Antony-hash512, используя утилиту gh. Используй MCP-сервер context7. Проанализируй изменения в исходном коде, убедись, что проект собирается без ошибок, а тесты зелёные."

Claude Code автоматически:

  • Выполнит команду gh pr checkout (или аналогичную), чтобы переключиться на нужную ветку.
  • Изучит измененные файлы кода.
  • Запустит команды сборки и проверки (например, npm run build или тесты), чтобы убедиться в работоспособности Electron-приложения.

…erer crash diagnostics, and optimize MediaBin text array initialization
… E2E state management, and enable software GL via remote debugging port
- Add \`corsEnabled\` and \`standard\` to scheme privileges for Electron 42+
  (Chromium blocks cross-origin requests to non-standard schemes in dev)
- Implement Content-Type headers by file extension for correct codec selection
- Move SwiftShader from automatic (on --remote-debugging-port) to explicit opt-in
  (KADR_SOFTWARE_GL or genuine headless detection) — upstream Chromium cannot
  composite video under software rendering due to MailboxVideoFrameConverter
  limitations, so tests use real GPU when display is available
- Fix Range request handling: return 416 on unsatisfiable ranges instead of crash
- Clean up: remove 'crashed' event handler (deprecated in Electron 42)
- Increase version to 0.2.0 for Electron 42 compatibility fixes
- Add docs/notes/library-updates.md (en) and library-updates-ru.md (ru)
  documenting protocol privilege requirements, SwiftShader video limitations,
  and CI setup for headless environments
- Reference upstream issues and Chromium docs for future maintainers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant